package com.cooldatasoft.exception;

import com.cooldatasoft.Support.TranslatableMessage;


public class TaskManagerUserException extends TaskManagerException {

  private static final long serialVersionUID = 5828499262794237341L;
  private TranslatableMessage message; 
  
  public TaskManagerUserException(String dictionaryKey, String defaultMessage, Throwable cause) {
    super(cause);
    message = new TranslatableMessage(dictionaryKey, defaultMessage);
  }
  
  public TaskManagerUserException(String dictionaryKey, String defaultMessage) {
    super(defaultMessage);
    message = new TranslatableMessage(dictionaryKey, defaultMessage);
  }
  
  public TaskManagerUserException(String dictionaryKey, String defaultMessage, String[] propertyKeys) {
    super(defaultMessage);
    message = new TranslatableMessage(dictionaryKey, propertyKeys, defaultMessage);
  }
  
  public TaskManagerUserException(String msg, Throwable cause) {
    super(msg, cause);
  }
  
  public TaskManagerUserException(String msg) {
    super(msg);
  }

  public String getDictionaryKey() {
    if (message == null) {
      return null;
    }
    return message.getDictionaryKey();
  }

  public void setDictionaryKey(String dictionaryKey) {
    if (message == null) {
      message = new TranslatableMessage();
    }
    message.setDictionaryKey(dictionaryKey);
  }

  public String getDefaultMessage() {
    if (message == null) {
      return getMessage();
    }
    return message.getDefaultMessage();
  }

  public void setDefaultMessage(String defaultMessage) {
    if (message == null) {
      message = new TranslatableMessage();
    }
    message.setDefaultMessage(defaultMessage);
  }

  public String[] getPropertyKeys() {
    if (message == null) {
      return null;
    }
    return message.getPropertyKeys();
  }

  public void setPropertyKeys(String[] propertyKeys) {
    if (message == null) {
      message = new TranslatableMessage();
    }
    message.setPropertyKeys(propertyKeys);
  }
  
  public Integer getCode() {
    if (message == null) {
      return null;
    }
    return message.getCode();
  }

  public void setCode(Integer code) {
    if (message == null) {
      message = new TranslatableMessage();
    }
    message.setCode(code);
  }
}
